package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
<#if generateService>
import ${package.Service}.${table.serviceName};
</#if>
import ${superServiceImplClassPackage};
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.life.xxx.util.Page;

import java.util.List;

/**
* <p>
    * ${table.comment!} 服务实现类
    * </p>
*
* @author ${author}
* @since ${date}
*/
@Service
<#if kotlin>
    open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>()<#if generateService>, ${table.serviceName}</#if> {

    }
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}><#if generateService> implements ${table.serviceName}</#if> {

    @Autowired
    private ${table.mapperName} ${table.mapperName?uncap_first};

    @Override
    public Page<${entity}> queryByPage(Page<${entity}> page, ${entity} ${entity?uncap_first}) {
        //1.查询当前的所有的记录数
        Integer totalCount = ${table.mapperName?uncap_first}.queryByCount( ${entity?uncap_first} );
        page.setTotalCount( totalCount );
        //2.分页查询
        List<${entity}> list =${table.mapperName?uncap_first}.queryByPage(page.getFirst(),page.getPageSize(),${entity?uncap_first});
        page.setResult( list );
        return page;
    }
}
</#if>
